<?php

namespace App\Http\Controllers\Guard\Setting;

use App\Http\Controllers\Common\ApiController;
use App\Models\Setting\Setting;
use Illuminate\Http\Request;

class SettingController extends ApiController{


    public function __construct() {
        $this->instance = new Setting();
    }

    public function lst(Request $request) {
        $records = $this->instance->newQuery()->get();
        return responseSuccess($records->toArray());

    }

    public function add(Request $request) {


        if($request->has('qr')){
            //客服二维码
            $qr = $request->input('qr');
            $record = $this->instance->updateOrCreate(['key'=>'qr'],['key'=>'qr','val'=>$qr,'description'=>'客服二维码']);
        }
        return responseSuccess([]);
    }
}
